home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 001a / combi11c.zip / IOCTL.H < prev    next >
C/C++ Source or Header  |  1992-07-27  |  4KB  |  100 lines

  1. struct combi_status {
  2.   char ID_name[6];      /* COMBI-disk always returns "COMBI\0"  */
  3.   int  version;         /* version number: high byte - major version number,
  4.                          *      low byte - minor version number */
  5.   char COMBI_options;   /* current options (see also below)     */
  6.   char bl_sect;         /* number of sectors per allocation block */
  7.   int  buff_size;       /* maximum buffer size (Kbytes)   */
  8.   int  curr_size;       /* current buffer size (Kbytes) - may be less than
  9.                          * buff_size if some memory is loaned to other
  10.                          * programs */
  11.   int  n_blocks;        /* total number of allocation blocks  */
  12.   int  n_curr;          /* current number of allocation blocks - less or
  13.                          * equal to the above */
  14.   int  n_bl_RD;         /* number of blocks used by RAM disk  */
  15.   int  n_bl_Cache;      /* number of blocks used by cache or unused */
  16.   int  n_dirty;         /* number of blocks which are waiting to be updated
  17.                          * to hard disk - this is likely to be 0 by the
  18.                          * time You run the program */
  19.   int  n_errors;        /* number of blocks which can't be updated to disk
  20.                          * due to write errors    */
  21.  
  22.   int  read_rq;         /* total number of read from hard disk requests
  23.                          * served by COMBI-disk */
  24.   int  read_sect;       /* same as above in sectors */
  25.   int  read_rq_a;       /* actual number of read requests passed
  26.                          * to BIOS by COMBI */
  27.   int  read_sect_a;     /* same as above in sectors */
  28.  
  29.   int  write_rq;        /* this and following 3 fields correspond to the  */
  30.   int  write_sect;      /* above 4 and contain WRITE statistics */
  31.   int  write_rq_a;
  32.   int  write_sect_a;
  33.  
  34.   int  read_RD_num;     /* RAM disk read/write statistics -
  35.                          * self-explanatory */
  36.   int  read_RD_sect;
  37.   int  write_RD_num;
  38.   int  write_RD_sect;
  39. };
  40.  
  41. /*  Write IOCtl packet has the following structure:
  42.  *  struct  wr_ioctl {
  43.  *    int     version;
  44.  *    char    command;
  45.  *    [<parameters for command if any>];
  46.  *    char    next_command;
  47.  *    [<parameters for that command if any>];
  48.  *    ....
  49.  *  }
  50.  */
  51.  
  52.  
  53. /* IOCtl commands definitions */
  54.  
  55. #define CMD_FLUSH   0x80
  56.     /* flush cache - no parameters, returns error
  57.      * if can't write to disk some of sectors  */
  58. #define CMD_CH_OPT  0x81
  59.     /* change options - the byte with new options follows */
  60. #define CMD_SHRINK  0x82
  61.     /* shrink memory - next word is parameter - the amount of Kbytes
  62.      * to release */
  63. #define CMD_EXPAND  0x83
  64.     /* similar to the above */
  65. #define CMD_N_ERR   0x84
  66.     /* get information on n-th unupdated block (with write errors)
  67.      * next word is n (<= n_dirty) and next 2 words is far pointer to
  68.      * the following struct:
  69.      *  struct bl_inf {
  70.      *    long  block_ID; - high byte is the physical drive number,
  71.      *                      the rest when multiplied by bl_sect gives 
  72.      *                      sequential number of first sector in that block
  73.      *                      (cylinder_number*sectors_per_cylinder+
  74.      *                      +head_number*sectors_per_track+
  75.      *                      +sector_number-1)
  76.      *    char  valid_sect; - bits of valid sectors in block
  77.      *    char  unupdated_sectors;
  78.      *    char  last_error; - as returned by BIOS
  79.      *    char  error_counter;  - number of errors
  80.      *   }
  81.      * You may use this information to discover physical sector
  82.      * number (cylinder,head,sector) which caused the error*/
  83. #define CMD_RESET_D 0x85
  84.     /* reset write errors so that background routine can attempt to 
  85.      * update block again, next DWORD is block ID */
  86. #define CMD_RESET_C 0x86
  87.     /* reset counters - next byte is parameter which statistics counters
  88.      * to reset: bit 0 corresponds to hard disk read counters, 
  89.      * bit 1 - to hard disk write counters and bit 2  - to RAM disk 
  90.      * read/write counters */
  91.  
  92. /* Options definitions        */
  93.  
  94. #define OPT_OFF     1     // cache off
  95. #define OPT_FREEZE  2     // freeze cache
  96. #define OPT_WR_ON   4     // write caching on
  97. #define OPT_DW_OFF  8     // delayed write off == start writing immediately
  98. #define OPT_MEM    0x20   // fix memory allocation
  99. #define OPT_NO_SNF 0x40   // no 'sector not found' error
  100.